﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;



namespace cz.uhul.DSMLv2
{

  /// <summary>
  /// The LdEntry represents one directory entry including its DN and attributes
  /// </summary>
  public class LdEntry
  {


    public LdEntry()
    {
      Attributes = new LdAttrCollection();
    }





    [XmlIgnore]
    public LdDistinguishedName DistinguishedName { get; set; }


    [XmlAttribute("dn")]
    [System.ComponentModel.Browsable(false), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
    public string DnString
    {
      get { return DistinguishedName == null ? null : DistinguishedName; }
      set { DistinguishedName = value == null ? null : LdDistinguishedName.Parse(value); }
    }




    /// <summary>
    /// current directory entry attributes
    /// </summary>
    [XmlElement(ElementName = "attr", Order = 1, Form = XmlSchemaForm.None, IsNullable = false)]
    public LdAttrCollection Attributes { get; set; }





    /// <summary>
    /// indicated whether current LdEntry is class instance or class definition.
    /// </summary>
    [XmlIgnore]
    public bool IsInstance { get; set; }





    ///// <summary>
    ///// indicates whether current LdEntry is valid, with all MUST attributes filled
    ///// </summary>
    //[XmlIgnore]
    //public bool IsDirty { get; set; }





    /// <summary>
    /// get / set hash used to unique identify current LdEntry
    /// </summary>
    [XmlIgnore]
    public Guid DnKey { get; set; }






    //public DateTime LastUpdatedDate { get; set; }


  }

}
